package com.wzj.dao.impl;

import com.wzj.dao.StudentDao;
import com.wzj.entity.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class StudentDaoImpl implements StudentDao {
    @Autowired
    private JdbcTemplate jdbcTemplate;

    @Override
    public List<Student> findStudentsBySex(String sex) {
        return jdbcTemplate.query("select * from Student where sex = ?",new BeanPropertyRowMapper<>(Student.class),sex);
    }
}
